<template>
  <div class="E-module-search">
    <mu-container class="wrap-search">
      <mu-paper :z-depth="2" style="padding:0 8px;">
        <mu-text-field
          v-model="value"
          @keyup.enter="submit(value,home.defaultSeo)"
          :placeholder="home.placeholder"
          solo
          full-width
          class="demo-divider-form"
          @input="searchEntry(value)"
          v-activateInp="home.efficientSearch"
        >
          <mu-button
            class="search-btn"
            @click="submit(value,home.defaultSeo)"
            small
            icon
            :color="value&&'#5cb6ff'"
          >
            <i class="fa fa-search" />
          </mu-button>
        </mu-text-field>
      </mu-paper>
    </mu-container>
    <!--  -->
    <mu-container v-if="value" class="wrap-entry">
      <el-tabs v-model="tabsName" @tab-click="tabAlter(tabsName)">
        <el-tab-pane label="网页" name="web">
          <E-web-list :data="entry.web" @open="submit" @add="searchEntry" />
        </el-tab-pane>
        <el-tab-pane label="音乐" name="music">
          <E-music-list :data="entry.music" v-model="reqTo" />
        </el-tab-pane>
        <!-- <el-tab-pane label="查快递" name="courier">
          <E-courier-list :data="entry.courier" @open="getCourierResult" />
        </el-tab-pane>-->
      </el-tabs>
      <mu-paper class="pack-up" :z-depth="2">
        <mu-list style="padding:0;margin-top:5px;">
          <mu-list-item :ripple="false">
            <div class="wrap-btn-left">
              <mu-button
                style="position:relative;left:5px;"
                @click="submit(value,'baidu')"
                small
                icon
                color="primary"
              >
                <div class="svg" style="width:25px;height:25px;">
                  <svg
                    t="1571160781057"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="1979"
                    width="20"
                    height="20"
                  >
                    <path
                      d="M345.705929 297.42283c15.350222 12.791852 35.817184 20.466963 53.725777 17.908592 20.466963 0 38.375555-10.233481 53.725777-23.025333 17.908592-15.350222 30.700444-35.817184 40.933925-58.842517 17.908592-43.492295 17.908592-97.218072 2.55837-143.268738-10.233481-30.700444-28.142073-58.842517-53.725777-76.75111-15.350222-10.233481-38.375555-15.350222-58.842517-12.791851-12.791852 2.55837-25.583703 7.675111-38.375555 15.350222-23.025333 15.350222-38.375555 40.933925-48.609036 66.517628-12.791852 46.050666-15.350222 92.101331-2.55837 138.151997 10.233481 28.142073 25.583703 56.284147 51.167406 76.75111zM601.542961 299.9812c17.908592 15.350222 40.933925 25.583703 63.959258 25.583703 20.466963 2.55837 38.375555-2.55837 56.284147-12.791851 17.908592-10.233481 33.258814-25.583703 43.492295-43.492296 12.791852-20.466963 23.025333-40.933925 30.700444-63.959258 5.116741-17.908592 7.675111-38.375555 5.116741-58.842517-2.55837-28.142073-15.350222-53.725777-33.258814-76.75111-12.791852-15.350222-28.142073-30.700444-46.050666-38.375554-12.791852-5.116741-28.142073-10.233481-40.933925-7.675111-17.908592 2.55837-33.258814 12.791852-46.050666 23.025332-17.908592 15.350222-33.258814 33.258814-43.492295 53.725777-10.233481 17.908592-20.466963 38.375555-23.025333 61.400888-2.55837 25.583703-2.55837 51.167406 2.55837 74.192739 5.116741 23.025333 12.791852 46.050666 30.700444 63.959258zM245.929487 509.767566c17.908592-15.350222 28.142073-35.817184 35.817184-56.284147 10.233481-33.258814 10.233481-66.517628 7.675111-99.776442 0-12.791852-5.116741-25.583703-10.233481-38.375555-12.791852-28.142073-35.817184-53.725777-63.959258-69.075999-23.025333-10.233481-46.050666-15.350222-66.517628-10.233481-25.583703 2.55837-46.050666 20.466963-61.400888 40.933925-20.466963 28.142073-30.700444 63.959258-35.817184 97.218072-2.55837 20.466963 0 40.933925 5.11674 61.400888 7.675111 30.700444 23.025333 58.842517 46.050666 79.30948 17.908592 15.350222 40.933925 23.025333 63.959258 23.025333 28.142073 0 56.284147-7.675111 79.30948-28.142074zM982.740139 433.016457c-2.55837-20.466963-7.675111-38.375555-17.908593-56.284147-10.233481-20.466963-28.142073-40.933925-48.609036-51.167407-23.025333-12.791852-51.167406-15.350222-76.751109-12.791851-12.791852 2.55837-28.142073 5.116741-40.933925 12.791851-17.908592 10.233481-30.700444 28.142073-40.933925 48.609036-10.233481 25.583703-15.350222 53.725777-15.350222 81.86785 0 25.583703 0 53.725777 7.675111 79.30948 5.116741 17.908592 15.350222 38.375555 33.258814 48.609036 17.908592 15.350222 40.933925 20.466963 63.959258 23.025333 17.908592 2.55837 38.375555 2.55837 56.284147-2.55837 17.908592-5.116741 35.817184-15.350222 46.050665-30.700444 12.791852-15.350222 20.466963-35.817184 23.025333-53.725777 12.791852-30.700444 10.233481-58.842517 10.233482-86.98459z"
                      fill="#306CFF"
                      p-id="1980"
                    />
                    <path
                      d="M911.10577 819.330375c-2.55837-35.817184-20.466963-71.634369-46.050666-99.776443-5.116741-5.116741-10.233481-10.233481-17.908592-15.350222-33.258814-28.142073-66.517628-58.842517-99.776443-89.542961-33.258814-33.258814-63.959258-69.075999-92.101331-107.451553-20.466963-33.258814-48.609036-63.959258-86.984591-81.86785-23.025333-10.233481-51.167406-15.350222-76.75111-12.791852-46.050666 5.116741-86.984591 30.700444-115.126664 66.517628-7.675111 7.675111-12.791852 17.908592-17.908592 28.142074-20.466963 30.700444-46.050666 61.400888-74.192739 86.984591-15.350222 15.350222-30.700444 28.142073-46.050666 40.933925-7.675111 7.675111-17.908592 15.350222-25.583703 23.025333-30.700444 23.025333-61.400888 53.725777-79.30948 86.98459-12.791852 23.025333-20.466963 48.609036-23.025333 76.75111 0 23.025333 2.55837 46.050666 10.233481 66.517628 7.675111 23.025333 17.908592 46.050666 33.258814 63.959258 25.583703 30.700444 63.959258 51.167406 102.334813 53.725777 48.609036 2.55837 97.218072 0 143.268738-7.675111 20.466963-2.55837 40.933925-10.233481 63.959258-12.791852 46.050666-5.116741 92.101331-2.55837 135.593627 10.233482 35.817184 12.791852 74.192739 17.908592 112.568294 20.466962 38.375555 2.55837 79.30948-2.55837 115.126664-23.025333 25.583703-12.791852 46.050666-35.817184 58.842517-61.400887 20.466963-33.258814 30.700444-71.634369 25.583704-112.568294z m-429.806214 104.893183h-117.685034c-12.791852 0-25.583703 0-38.375555-2.558371-25.583703-5.116741-48.609036-20.466963-63.959258-43.492295-12.791852-15.350222-20.466963-33.258814-23.025333-53.725777-2.55837-20.466963-2.55837-40.933925 0-61.400887 5.116741-23.025333 17.908592-43.492295 33.258814-58.842518 12.791852-12.791852 30.700444-23.025333 48.609036-30.700444 7.675111-2.55837 15.350222-5.116741 23.025333-5.11674h69.075999v-97.218072h66.517628c2.55837 120.243405 2.55837 237.92844 2.55837 353.055104z m263.512143 0h-161.17733c-17.908592-2.55837-33.258814-7.675111-46.050666-17.908593-15.350222-12.791852-23.025333-33.258814-23.025333-51.167406v-173.969182h66.517629v161.17733c0 7.675111 2.55837 12.791852 7.675111 17.908593 5.116741 5.116741 12.791852 7.675111 20.466962 7.675111h69.075999v-189.319404h66.517628v245.603551z"
                      fill="#306CFF"
                      p-id="1981"
                    />
                    <path
                      d="M340.589189 734.904154c-12.791852 5.116741-25.583703 15.350222-33.258814 30.700444-5.116741 12.791852-7.675111 25.583703-7.675111 38.375555 0 15.350222 5.116741 30.700444 12.791851 43.492295 10.233481 15.350222 28.142073 25.583703 46.050666 23.025333h53.725777v-138.151997h-58.842518c-2.55837-2.55837-7.675111 0-12.791851 2.55837z"
                      fill="#306CFF"
                      p-id="1982"
                    />
                  </svg>
                </div>
              </mu-button>
              <mu-button
                style="position:relative;left:5px;"
                @click="submit(value,'sm')"
                small
                icon
                color="orange700"
              >
                <div class="svg" style="width:22px;height:22px;">
                  <svg
                    t="1571161850107"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="1161"
                    width="22"
                    height="22"
                  >
                    <path
                      d="M441.173333 408.177778c-2.133333 0.426667-5.12 2.702222-5.262222 4.551111-2.133333 12.657778-3.697778 25.457778-5.831111 41.244444 25.031111-4.124444 46.933333-7.68 69.262222-11.235555-7.111111-21.191111-39.537778-39.537778-58.168889-34.56zM352.142222 575.431111c3.128889-0.426667 7.964444-3.271111 8.533334-5.831111 5.12-27.591111 9.528889-55.324444 14.648888-86.471111-23.182222 6.542222-40.675556 14.364444-54.471111 29.155555-12.088889 12.942222-14.791111 28.444444-7.964444 42.097778 6.257778 12.657778 24.462222 22.613333 39.253333 21.048889zM464.071111 544.284444c21.475556-15.075556 33.848889-35.697778 37.546667-61.724444 1.422222-9.386667-1.564444-14.364444-11.804445-13.084444-18.915556 2.275556-38.115556 3.982222-56.888889 7.111111-3.84 0.711111-8.817778 6.826667-9.671111 11.093333-3.84 22.755556-6.542222 45.653333-9.386666 68.551111-0.426667 2.275556 0.426667 4.977778 1.137777 8.817778 18.488889-3.128889 34.417778-10.524444 49.066667-20.764445z"
                      p-id="1162"
                      fill="#e78000"
                    />
                    <path
                      d="M512 0C229.262222 0 0 229.262222 0 512s229.262222 512 512 512 512-229.262222 512-512S794.737778 0 512 0z m157.44 342.328889c44.942222-12.942222 89.742222-27.022222 136.96-27.306667 25.457778-0.142222 51.626667 2.133333 76.373333 7.822222 29.155556 6.542222 41.102222 25.742222 38.826667 55.324445-2.702222 36.693333-16.782222 70.115556-32 104.675555-18.062222-5.973333-35.128889-11.52-52.906667-17.351111 9.102222-22.755556 17.777778-43.377778 25.457778-64.284444 2.275556-6.4 2.986667-13.653333 3.128889-20.622222 0.284444-13.368889-6.115556-24.177778-19.2-26.026667-18.773333-2.56-38.4-4.977778-56.888889-2.133333-45.226667 6.968889-90.026667 16.924444-135.111111 25.6-3.697778 0.711111-7.537778 0.995556-12.515556 1.564444 4.266667-17.208889 7.964444-31.431111 27.875556-37.262222z m-499.2-7.111111c16.213333-2.417778 32.853333-1.422222 49.351111-0.426667 9.386667 0.568889 14.933333 7.822222 14.222222 17.208889-0.711111 8.533333-6.968889 12.088889-15.786666 11.946667-27.733333-0.284444-55.608889-0.142222-83.626667-0.426667-1.137778 0-2.275556-0.853333-4.977778-1.991111 9.102222-17.351111 24.746667-23.893333 40.817778-26.311111z m71.253333 224.995555c-3.271111 5.688889-6.542222 6.968889-12.515555 3.982223-10.666667-5.546667-21.76-10.382222-35.697778-16.924445-3.271111 23.324444-6.4 43.946667-9.244444 64.426667-2.702222 19.911111-5.404444 39.822222-7.822223 59.733333-0.853333 7.253333-4.124444 10.808889-11.804444 10.666667-12.231111-0.426667-24.32-0.142222-39.253333-0.142222 7.537778-43.946667 14.791111-85.902222 22.613333-131.128889-28.017778 7.537778-52.053333 14.08-79.36 21.475555 4.693333-14.08 7.68-25.315556 12.515555-35.697778 1.422222-3.271111 7.537778-4.835556 11.662223-6.826666 22.897778-10.666667 46.648889-19.911111 68.551111-32.142222 10.808889-5.973333 20.337778-16.64 27.164444-27.306667 10.666667-16.782222 2.56-32.853333-17.066666-33.137778-22.897778-0.426667-45.937778 2.844444-68.977778 4.551111-1.991111 0.142222-3.982222 0.711111-6.257778 1.137778 4.408889-24.746667 9.671111-30.577778 31.857778-32.711111 23.893333-2.275556 47.786667-3.555556 71.68-4.977778 5.12-0.284444 10.524444 0.426667 15.644444 1.422222 27.022222 4.835556 36.835556 21.76 27.591111 47.644445-2.275556 6.542222-4.551111 13.795556-8.96 18.773333-12.942222 14.506667-8.248889 27.591111 1.28 41.102222l4.266667 6.4c13.795556 18.062222 13.653333 20.195556 2.133333 39.68z m34.133334-38.542222c13.084444-20.053333 32.711111-32.426667 53.475555-43.093333 8.106667-4.124444 16.497778-9.102222 25.315556-10.524445 20.053333-3.128889 27.733333-14.933333 28.017778-33.848889 0.142222-1.706667 0.426667-3.413333 0.711111-5.12 3.982222-29.866667 3.84-30.008889-26.453334-24.462222-8.533333 1.564444-16.924444 4.408889-24.746666 8.106667-26.453333 12.231111-33.422222 28.16-24.888889 57.173333-19.342222-4.835556-29.013333-25.315556-22.755556-46.08 4.551111-15.217778 14.648889-26.453333 28.728889-32.284444 20.48-8.391111 41.671111-15.36 63.004445-21.048889 11.662222-3.128889 18.062222-6.826667 18.915555-20.053333 2.275556-31.573333 3.128889-31.431111 34.56-31.431112 18.346667 0 18.062222 0 15.217778 18.062223-4.551111 30.435556-4.266667 24.177778 19.626667 30.008889 37.546667 9.244444 69.12 25.742222 86.755555 63.004444 2.275556 4.977778 11.946667 6.4 20.906667 10.808889 0 1.706667-0.142222 7.111111 0 12.657778 0.284444 8.248889-3.697778 12.088889-11.946667 11.52-7.964444-0.568889-13.226667 2.275556-15.928889 10.382222-18.204444 52.48-54.186667 89.457778-104.248889 111.502222-22.471111 9.955556-36.266667 22.613333-35.128889 48.213333 0.426667 12.515556-6.115556 16.213333-18.062222 15.217778-11.52-1.137778-23.324444-0.284444-37.262222-0.284444 1.564444-11.52 2.702222-20.764444 4.124444-30.008889 2.275556-16.497778 1.706667-17.066667-14.08-18.488889-9.955556-0.711111-20.053333-1.706667-30.008888-3.271111-38.4-6.4-55.04-43.946667-33.848889-76.657778z m62.435555 187.306667c-0.426667-1.706667-0.853333-3.271111-1.422222-5.12 37.12-13.795556 73.671111-29.155556 111.502222-41.244445 77.226667-24.462222 156.728889-38.4 236.515556-51.342222 9.813333-1.564444 22.044444-1.28 28.728889-6.968889 5.546667-4.693333 4.408889-17.066667 6.542222-27.164444 36.124444 5.12 69.404444 17.066667 99.271111 46.791111-166.115556 7.68-325.831111 34.417778-481.137778 85.048889z m497.066667-13.937778c-20.906667 4.408889-42.951111 4.124444-66.986667 6.257778 6.542222-18.346667 11.235556-31.288889 30.293334-34.133334 15.217778-2.275556 30.008889-8.817778 44.942222-13.937777 15.075556-5.12 26.168889-15.502222 34.133333-29.155556 17.351111-29.44 5.688889-63.573333-27.875555-71.68-28.16-6.826667-57.742222-9.813333-86.755556-10.951111-44.8-1.706667-89.6-0.426667-136.248889-0.426667 3.982222-14.364444 7.822222-29.44 12.373333-44.231111 6.542222-21.76 14.364444-43.093333 20.053334-64.995555 4.266667-16.782222 13.511111-26.311111 30.151111-30.008889 5.973333-1.28 11.52-3.697778 20.906667-6.826667-10.808889 37.546667-20.906667 72.248889-31.288889 107.804445 5.12 0.426667 7.964444 0.995556 10.951111 0.995555 55.893333 1.137778 111.644444 1.422222 167.537778 3.413333 16.355556 0.568889 32.995556 4.124444 48.924444 8.533334 42.808889 12.088889 58.737778 44.088889 44.088889 86.186666-18.773333 55.04-61.44 81.635556-115.2 93.155556z"
                      p-id="1163"
                      fill="#e78000"
                    />
                  </svg>
                </div>
              </mu-button>
              <mu-button
                style="position:relative;left:5px;"
                @click="submit(value,'google')"
                small
                icon
                color="redA700"
              >
                <div class="svg" style="width:21px;height:21px;">
                  <svg
                    t="1571161324128"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="1774"
                    width="21"
                    height="21"
                  >
                    <path
                      d="M1011.798 521.58c0-41.953-3.404-72.568-10.772-104.316h-479.06v189.354h281.198c-5.667 47.057-36.282 117.925-104.315 165.544l-0.954 6.34 151.47 117.342 10.494 1.047c96.377-89.01 151.939-219.972 151.939-375.312"
                      fill="#4285F4"
                      p-id="1775"
                    />
                    <path
                      d="M521.966 1020.482c137.764 0 253.417-45.357 337.893-123.59l-161.01-124.73c-43.086 30.048-100.915 51.025-176.883 51.025-134.93 0-249.45-89.006-290.272-212.031l-5.984 0.508-157.5 121.891-2.06 5.726c83.905 166.678 256.254 281.201 455.816 281.201"
                      fill="#34A853"
                      p-id="1776"
                    />
                    <path
                      d="M231.694 611.156c-10.772-31.748-17.006-65.767-17.006-100.915 0-35.152 6.234-69.167 16.439-100.915l-0.285-6.761-159.475-123.85-5.217 2.482c-34.582 69.167-54.425 146.839-54.425 229.044s19.843 159.873 54.425 229.04l165.544-128.125"
                      fill="#FBBC05"
                      p-id="1777"
                    />
                    <path
                      d="M521.966 197.292c95.81 0 160.44 41.386 197.292 75.971l144.001-140.6C774.82 50.457 659.73 0 521.966 0 322.404 0 150.056 114.52 66.15 281.197l164.977 128.13c41.39-123.025 155.91-212.035 290.84-212.035"
                      fill="#EB4335"
                      p-id="1778"
                    />
                  </svg>
                </div>
              </mu-button>
              <mu-button
                style="position:relative;left:5px;"
                @click="submit(value,'magi')"
                small
                icon
                color="primary"
              >
                <div class="svg" style="width:22px;height:22px;">
                  <svg
                    t="1573393970415"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="693"
                    width="22"
                    height="22"
                  >
                    <path
                      d="M228.266667 266.88h72.746666v72.746667H228.266667zM380.373333 197.12h102.186667v102.186667h-102.186667zM303.786667 349.013333v49.706667h-50.133334v368.426667l119.68 65.28V349.013333h-69.546666zM769.066667 767.146667l-121.386667 68.053333V617.173333h121.386667v149.973334zM573.226667 877.653333L512 910.933333l-61.226667-33.28V481.066667h122.453334v396.586666z"
                      fill="#583ACA"
                      p-id="694"
                    />
                    <path
                      d="M512 0L196.48 176.853333h32.853333v44.16L512 62.72l401.066667 224.64v449.28L512 961.28 110.933333 736.64V287.36l43.306667-24.32H142.933333V206.72L55.04 256v512L512 1024l456.96-256V256L512 0z"
                      fill="#583ACA"
                      p-id="695"
                    />
                  </svg>
                </div>
              </mu-button>
              <!-- 音乐 -->
              <!-- <mu-button
                style="position:relative;left:5px;"
                @click="submit(value,'music')"
                small
                icon
                color="primary"
              >
                <div class="svg" style="width:25px;height:25px;">
                  <svg
                    t="1571161602102"
                    class="icon"
                    viewBox="0 0 1024 1024"
                    version="1.1"
                    xmlns="http://www.w3.org/2000/svg"
                    p-id="3847"
                    width="25"
                    height="25"
                  >
                    <path
                      d="M305.93219 953.929143c-243.638857-113.615238-349.525333-404.260571-235.861333-647.996953 113.615238-243.638857 404.260571-349.525333 647.996953-235.861333 243.638857 113.615238 349.525333 404.260571 235.861333 647.996953-113.664 243.736381-404.382476 349.476571-647.996953 235.861333z"
                      fill="#69E8EA"
                      fill-opacity="0.3"
                      p-id="3848"
                    />
                    <path
                      d="M797.793524 495.762286a160.597333 160.597333 0 0 1-77.580191-213.138286 29.257143 29.257143 0 0 0-52.955428-24.697905c-1.316571 2.852571-2.511238 5.632-3.681524 8.43581a16.14019 16.14019 0 0 0-1.170286 1.950476l-123.270095 264.338286a166.814476 166.814476 0 0 0-81.822476-83.163429 167.838476 167.838476 0 0 0-222.768762 81.091048 167.838476 167.838476 0 0 0 81.091048 222.768762c81.895619 38.204952 179.053714 4.217905 219.867428-75.629715 0.560762-0.926476 1.170286-1.706667 1.633524-2.681904l120.271238-257.974858a217.965714 217.965714 0 0 0 115.687619 131.413334 29.257143 29.257143 0 0 0 38.838857-14.116572 29.013333 29.013333 0 0 0-14.140952-38.595047z m-457.411048 204.775619a109.421714 109.421714 0 0 1-52.882286-145.261715 109.421714 109.421714 0 0 1 145.261715-52.882285 109.421714 109.421714 0 0 1 52.882285 145.261714 109.421714 109.421714 0 0 1-145.261714 52.882286z"
                      fill="#75D0D2"
                      p-id="3849"
                    />
                  </svg>
                </div>
              </mu-button>-->
            </div>
            <div class="wrap-btn-right">
              <mu-button
                small
                style="min-width:unset;"
                color="primary"
                full-width
                flat
                @click="clearEntry(true)"
              >收起</mu-button>
            </div>
          </mu-list-item>
        </mu-list>
      </mu-paper>
    </mu-container>
  </div>
</template>

<script>
import musicApi from "@/plug-in/musicApi.js";
import EWebList from "./module-search/E-web-list";
import EMusicList from "./module-search/E-music-list";
import { api } from "@/plug-in/api.js";
import ECourierList from "./module-search/E-courier-list";
import { mapState } from "vuex";

export default {
  // activa -- 是否自动聚焦input
  components: { EWebList, EMusicList, ECourierList },
  props: ["req"],
  computed: {
    ...mapState("config", ["home"])
    // activa() {
    //   return this.$attrs.activa !== undefined;
    // }
  },
  data() {
    return {
      value: "",
      tabsName: "web",
      urlData: {
        baidu: "https://www.baidu.com/s?ie=UTF-8&wd=",
        sm: "https://so.m.sm.cn/s?q=",
        google: "https://www.google.com/search?q=",
        magi: "https://magi.com/search?q=",
        music: "",
        bing: "https://cn.bing.com/search?q="
      },
      entry: {
        web: [],
        music: [],
        courier: {}
      },
      reqTo: -1,
      timer: null
    };
  },
  mounted() {
    if (this.req.type === "music") {
      this.reqTo = 0;
      this.tabsName = "music";
      this.value = this.req.id;
      this.tabAlter("music");
    }
  },
  directives: {
    activateInp: {
      bind(el, binding, vnode) {
        if (binding.value)
          setTimeout(() => el.querySelector("input").focus(), 0);
      }
    }
  },
  methods: {
    tabAlter(name) {
      this.value && this.getData(name, this.value);
    },
    submit(val, key) {
      key = key === "default" ? this.home.defaultSeo : key;
      this.urlData[key] && location.assign(this.urlData[key] + val);
    },
    clearEntry(is) {
      this.entry.web = [];
      this.entry.music = [];
      this.entry.courier = {};
      if (is) {
        this.value = "";
        this.$router.replace({});
      }
    },
    searchEntry(val) {
      this.value = val;
      this.clearEntry();
      if (!val) return;
      this.getData(this.tabsName, val);
    },
    getData(type, val) {
      // 截流处理
      clearTimeout(this.timer);
      this.timer = setTimeout(() => {
        if (type === "web") {
          api.getEntrySuggest(val).then(data => (this.entry.web = data));
        } else if (type === "music") {
          musicApi.searchSonglist(val, 1, 10).then(list => {
            this.entry.music = list.map(ele => {
              ele.artistName = ele.artist.join("、");
              ele.fileName = ele.name + " - " + ele.artistName;
              return ele;
            });
          });
        } else if (type === "courier") {
          api.getCourier(val).then(data => (this.entry.courier = data));
        }
      }, 500);
    }
    // getCourierResult(type, num) {
    //   api.getCourierResult(type, num).then(data => {
    //     console.log(JSON.stringify(data,null,2));
    //   });
    // }
  }
};
</script>

<style lang="scss">
.E-module-search {
  z-index: 10;
  position: relative;
  margin-bottom: 20px;
  & > .wrap-search {
    margin-bottom: 5px;
    .search-btn {
      margin-left: 5px;
      font-size: 20px;
    }
  }

  & > .wrap-entry {
    z-index: 1;
    position: absolute;
    top: 53px;
    left: 50%;
    transform: translateX(-50%);
    & > .el-tabs.el-tabs--top {
      background: #fff;
      box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
        0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
      & > .el-tabs__header {
        margin: 0;
        .el-tabs__item {
          padding: 0;
          width: 60px;
          text-align: center;
        }
      }
      & > .el-tabs__content {
        .el-tab-pane {
          max-height: 244px;
          overflow-y: scroll;
          .mu-paper {
            background: transparent;
          }
        }
      }
    }
    .mu-list {
      & > li {
        border-bottom: 1px solid rgba(0, 0, 0, 0.12);
        &:last-of-type {
          border-bottom: none;
        }
      }
    }
    .pack-up {
      .mu-item {
        padding: 0 5px;
        display: flex;
        & > .wrap-btn-left {
          flex: 1;
          .mu-button {
            vertical-align: middle;
            .image {
              width: 25px;
              height: 25px;
              border-radius: 50%;
            }
          }
        }
        & > .wrap-btn-right {
          text-align: center;
          width: 50px;
        }
      }
    }
  }
}
</style>